//@ sourceURL=ExistingProblemsView.js
Ext.ns("ExistingProblemsView");

ExistingProblemsView = Ext.extend(Ext.Panel,{
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        ExistingProblemsView.superclass.constructor.call(this, {
            id : "ExistingProblemsView",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel]
        });
    },
    initUIComponents : function() {
    var yearGridComponents=new creategridview({
        topbar : {
            inputFormName : 'ExistingProblemsForm',
            topbarAdd:{
                hidden:false
            },
            topbarDel:{
                hidden:false
            }
        },
        search : {
            items : [ {
                style : "margin:5px 5px 5px 5px;",
                text : "隐患类型"
            }, {
                columnWidth : 0.2,
                xtype : "textfield",
                name : "Q_problemType_S_LK",
                maxLength : 256
            } ]
        },
        grid : {
            title : "检查隐患列表",
            rowActions:true,
            listUrl : __ctxPath + "/relatedparty/listExistingProblems.do?Q_sceneTaskManageId_L_EQ="+this.sceneTaskManageId,
            removeUrl : __ctxPath + "/relatedparty/deleteExistingProblems.do",
            fields : [ "id","problemType","problemGrade", "problemDescribe"],
            columns : [ {
                header : "id",
                dataIndex : "id",
                hidden : true
            },{
                header : "隐患类型",
                dataIndex : "problemType",
                width:80
            },{
                header : "隐患等级",
                dataIndex : "problemGrade",
                width:70
            },{
                header : "隐患描述",
                dataIndex : "problemDescribe",
                width:80
            },{
                header : "整改",
                dataIndex : "companyProfile",
                width : 50,
                renderer : function(j, i, g, m, h) {
                    var cfg={
                            existingProblemsId : g.data.id
                    }
                    var k = "";
                            k += '<button title="评估" value="" class="btn-showDetail" onclick=\'ExistingProblemsView.RectificaInfor('
                                + JSON.stringify(cfg) + ')\'></button>';
                    return k;
                }
            } ]
        },
        formCfg : {
            sceneTaskManageId : this.sceneTaskManageId
        }
        
    });
    return yearGridComponents;
}
});
ExistingProblemsView.RectificaInfor = function(existingProblems){
    new RectificationWindow({
        existingProblemsId:existingProblems.existingProblemsId
    }).show();
}

ExistingProblemsView.edit = function(id) {
    new ExistingProblemsForm({
        id : id,
        operation: Constant.Operation.EDIT
    }).show();
};